/*
*	冰火家族萬能NPC
*
*
*
*
*
*/
var x = "#fEffect/CharacterEff/1112949/0/0#";//高音譜記號
var kk = "#fEffect/BasicEff/MainNotice/Boss/Default/0#";//BOSS
var c = "#fEffect/CharacterEff/1032063/0/0#";//"#fUI/UIMiniGame/starPlanetRPS/heart#";//愛心
var cmark = "#fUI/UIMiniGame/starPlanetRPS/heart#";//愛心
var lb = "#fEffect/ItemEff/1112811/0/0#";//藍色小光
var b = "#fEffect/CharacterEff/Shaman/1#";//超萌熊熊
var cat = "#fEffect/CharacterEff/Shaman/4#";//超萌喵咪
var leaf = "#fUI/Basic.img/Cursor/18/0#";
var selec;
var status;
		
var towns = Array(
		Array(910001000,"專業技術村",true),
		Array(130000000,"耶雷弗",true),
		Array(310000000,"埃德爾斯坦",true),
		Array(104000000,"維多利亞港",true),
		Array(100000000,"弓箭手村",true),
		Array(101000000,"魔法森林",true),
		Array(102000000,"勇士之村",true),
		Array(103000000,"墮落城市",true),
		Array(120000000,"鯨魚號",true),
		Array(105000000,"奇幻村",true),
		Array(200000000,"天空之城",true),
		Array(211000000,"冰原雪域",true),
		Array(230000000,"水世界",true),
		Array(220000000,"玩具城",true),
		Array(250000000,"武陵桃園",true),
		Array(260000000,"納希沙漠",true),
		Array(600000000,"新葉城",true),
		Array(240000000,"神木村",true),
		Array(261000000,"瑪迦提亞",true),
		Array(251000000,"靈藥幻境",true),
		Array(300000000,"艾靈森林",true),
		Array(270000000,"時間神殿",true),
		Array(800000000,"日本神社",true)
);
function start() {
    status = -1;
    action(1, 0, 0);
}

function action(mode, type, selection) {

    if (mode == 0) {
	cm.dispose();
	return;
    } else if (mode == 1){
	status++;
    } else {
	status--;
    }

    switch (status) {
        case 0: 
			text = "\t  "+c+"#fn华文行楷##fs30##e#k #b城鎮傳送 " +c+ "\r\n#fs12##fn宋体#";
			for (var i = 0; i < towns.length; i++) {
				if (towns[i][2]) { // 如果允许显示
					text += "\t\t\t#d#L" + i + "# " + cmark +" " + towns[i][1] + "#l\r\n";
				}
			}
			text += "\r\n\r\n\t\t   #L999#" + leaf +"#fn华文行楷##fs22##e#r回上一頁#l"
			text += "\r\n\r\n  " +c+c+c+c+c+c;
			cm.sendSimple(text);
            break;
        case 1: //
			switch (selection){
				case 999://回上一頁
					cm.dispose();
					cm.openNpc(1052253, 4);
					break;
				default:
					selec = selection;
					cm.sendYesNo("您已經做好手邊的事情了嗎?\r\n即將為您傳送到 #b#fs15#" + towns[selec][1] + "#fs12#");
					break;
			}
            break;
		case 2:
			if (selec >= 0 && selec < towns.length && towns[selec] != null) {
				cm.warp(towns[selec][0]);
				cm.dispose();
			} else {
				cm.sendOk("傳送出現錯誤 請聯繫管理員");
				cm.dispose();
			}
			break;
        default:
			cm.sendOk("發生錯誤，請聯繫管理員!");
			cm.dispose();
			break;
    }
}
